-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: support depositAndCall
and withdrawAndCall
with empty message
#3018
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3018 +/- ##
===========================================
- Coverage 64.91% 64.47% -0.45%
===========================================
Files 408 409 +1
Lines 28407 28641 +234
===========================================
+ Hits 18441 18465 +24
- Misses 9170 9381 +211
+ Partials 796 795 -1
|
📝 WalkthroughWalkthroughThe pull request introduces extensive enhancements to the ZetaChain node, including updates to the changelog, new features, refactoring, testing improvements, and fixes. Key additions encompass support for stateful precompiled contracts, a common RPC package, and enhanced functionalities for staking and Bitcoin transactions. The modifications also include the introduction of new parameters, refined error handling, and expanded testing coverage. Overall, the changes aim to improve the reliability and performance of the ZetaChain protocol. Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 46
🧹 Outside diff range and nitpick comments (56)
docs/openapi/openapi.swagger.yaml (1)
57205-57209
: Approve addition with minor title refinement.The new
is_cross_chain_call
property is correctly defined and appropriately placed within the schema. The title provides valuable context for its purpose.To enhance clarity and maintain consistency with OpenAPI best practices, consider refining the title as follows:
is_cross_chain_call: type: boolean title: |- - this field describes if a smart contract call should be made for a inbound - with assets only used for protocol contract version 2 + Indicates whether a smart contract call should be made for an inbound + transaction with assets used only in protocol contract version 2This adjustment improves readability and aligns more closely with standard OpenAPI documentation practices.
pkg/contracts/testdappv2/bindings.go (1)
1-1
: Approve the EVM version specification and suggest pinning the compiler version.The addition of
--evm-version london
is a prudent change, ensuring compatibility with the London hard fork features. This explicit version specification aligns with best practices in Solidity development.To further enhance reproducibility and consistency across different environments, consider pinning the Solidity compiler version as well.
Modify the go:generate directive as follows:
-//go:generate sh -c "solc TestDAppV2.sol --evm-version london --combined-json abi,bin | jq '.contracts.\"TestDAppV2.sol:TestDAppV2\"' > TestDAppV2.json" +//go:generate sh -c "solc TestDAppV2.sol --evm-version london --combined-json abi,bin --version 0.8.18 | jq '.contracts.\"TestDAppV2.sol:TestDAppV2\"' > TestDAppV2.json"This change ensures that the contract is always compiled with a specific Solidity version, reducing the risk of unexpected behavior due to compiler differences.
e2e/e2etests/test_v2_erc20_deposit_and_call.go (1)
Line range hint
1-52
: Enhance error handling and consistency in the test function.While the function generally follows good practices, there are a few areas for improvement:
Error Handling: Some method calls that can return errors are not checked. For instance, the
V2ERC20DepositAndCall
call.Magic Numbers: The
OnRevertGasLimit
is set to 0 directly. Consider using a named constant for better readability and maintainability.Consistency: The function mixes direct error checks and the use of
r.
for assertions. Strive for consistency in error handling throughout the function.Consider applying these improvements:
- Add error checking:
tx, err := r.V2ERC20DepositAndCall( r.TestDAppV2ZEVMAddr, amount, []byte(payloadMessageDepositERC20), gatewayevm.RevertOptions{OnRevertGasLimit: big.NewInt(0)}, ) require.NoError(r, err)
- Use a named constant:
const defaultOnRevertGasLimit = 0 // ... gatewayevm.RevertOptions{OnRevertGasLimit: big.NewInt(defaultOnRevertGasLimit)},
- Consistently use
r.
for assertions:r.Require().NoError(err) r.Require().True(ok, "Invalid amount specified for TestV2ERC20DepositAndCall") // Apply this pattern throughout the functionThese changes will improve the robustness and readability of the test function.
e2e/e2etests/test_v2_eth_deposit_and_call_no_message.go (4)
15-22
: Consider enhancing error messages for improved debugging.The initial setup of the function is well-structured. However, to facilitate easier debugging, consider providing more descriptive error messages. For instance:
require.Len(r, args, 1, "TestV2ETHDepositAndCallNoMessage requires exactly one argument for the deposit amount") amount, ok := big.NewInt(0).SetString(args[0], 10) require.True(r, ok, "Invalid amount specified for TestV2ETHDepositAndCallNoMessage: %s", args[0])This change would provide more context in case of failures, aiding in quicker issue resolution.
24-30
: Document the rationale for RevertOptions configuration.The deposit and call execution is implemented correctly. However, the reasoning behind setting
OnRevertGasLimit
to 0 in theRevertOptions
is not immediately clear. Consider adding a comment explaining this choice:// perform the deposit and call to the TestDAppV2ZEVMAddr tx := r.V2ETHDepositAndCall( r.TestDAppV2ZEVMAddr, amount, []byte{}, gatewayevm.RevertOptions{ // OnRevertGasLimit is set to 0 to [explain the reason, e.g., "disable custom gas limit on revert"] OnRevertGasLimit: big.NewInt(0), }, )This documentation would clarify the intent and help maintain the code in the future.
37-40
: Enhance error handling for GetNoMessageIndex call.The payload reception check is implemented correctly. However, to improve robustness, consider adding more context to the error returned by
GetNoMessageIndex
. This can be achieved by wrapping the error:messageIndex, err := r.TestDAppV2ZEVM.GetNoMessageIndex(&bind.CallOpts{}, r.EVMAddress()) if err != nil { return fmt.Errorf("failed to get NoMessageIndex: %w", err) }This change would provide more context in case of failures, aiding in quicker issue resolution.
42-46
: Enhance assertion message for balance check.The balance update check is implemented correctly. To improve debugging in case of a failure, consider providing more context in the assertion message:
newBalance, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.TestDAppV2ZEVMAddr) require.NoError(r, err) expectedBalance := new(big.Int).Add(oldBalance, amount) require.Equal(r, expectedBalance, newBalance, "New balance (%s) does not match expected balance (%s)", newBalance, expectedBalance)This change would provide more detailed information about the actual and expected balances in case of a mismatch.
x/crosschain/types/inbound_parsing_test.go (3)
13-15
: Consider setting a timeline for completing the TODO items.While TODO comments are generally discouraged in production code, they can be acceptable in test files if properly tracked. However, it would be beneficial to set a timeline for addressing these incomplete tests to ensure comprehensive test coverage.
32-49
: Expand test coverage for NewWithdrawalInbound.The current test case for
NewWithdrawalInbound
is well-structured and correctly validates the error condition for an invalid chain ID. However, to ensure comprehensive coverage, consider adding the following test cases:
- A successful case with valid inputs.
- Edge cases for various input parameters (e.g., zero or negative amounts).
- Tests for different chain IDs and their corresponding behaviors.
Expanding the test suite will provide better confidence in the function's correctness across various scenarios.
51-68
: Expand test coverage and consider refactoring for NewCallInbound.The current test case for
NewCallInbound
is well-structured and correctly validates the error condition for an invalid chain ID. However, to improve the test suite:
Add more test cases:
- A successful case with valid inputs.
- Edge cases for various input parameters.
- Tests for different chain IDs and their corresponding behaviors.
Consider refactoring the common setup code for
TestNewWithdrawalInbound
andTestNewCallInbound
into a helper function to reduce duplication and improve maintainability.Example refactor:
func setupInvalidChainIDTest(t *testing.T) (types.Context, string) { _, ctx, _, _ := keepertest.CrosschainKeeper(t) ctx = ctx.WithChainID("invalidChainID") return ctx, sample.EthAddress().Hex() } // Use in both test functions ctx, sampleAddress := setupInvalidChainIDTest(t)This refactoring will make the tests more concise and easier to maintain.
zetaclient/chains/evm/cctx.go (1)
65-68
: Consistent logic applied to ERC20 transactions.The changes for ERC20 transactions mirror those made for gas transactions, maintaining consistency in the codebase. This parallel structure enhances readability and addresses the PR objectives for both transaction types.
Consider refactoring the common logic for both
CoinType_Gas
andCoinType_ERC20
cases to reduce code duplication and improve maintainability. For example:func determineOutboundType(isCrossChainCall bool, baseType, andCallType OutboundType) OutboundType { if isCrossChainCall { return andCallType } return baseType } // Usage in ParseOutboundTypeFromCCTX: case coin.CoinType_Gas: return determineOutboundType(cctx.InboundParams.IsCrossChainCall, OutboundTypeGasWithdraw, OutboundTypeGasWithdrawAndCall) case coin.CoinType_ERC20: return determineOutboundType(cctx.InboundParams.IsCrossChainCall, OutboundTypeERC20Withdraw, OutboundTypeERC20WithdrawAndCall)This refactoring would centralize the logic and make future modifications easier.
zetaclient/chains/evm/cctx_test.go (1)
13-96
: Comprehensive test coverage with minor improvements needed.The test cases cover a wide range of scenarios, including different coin types, cross-chain calls, and revert conditions. This comprehensive approach ensures robust testing of the
ParseOutboundTypeFromCCTX
function.However, there are two minor points for improvement:
There's a typo in the test case name on line 85. "Uuknown" should be "Unknown".
The test case for the ZETA coin type (lines 85-95) could be more explicit about why it results in an unknown outbound type. Consider adding a comment explaining this behavior or renaming the test case to better reflect the expected outcome.
Please apply the following changes:
- name: "ZETA gives Uuknown outbound type", + name: "ZETA results in Unknown outbound type",Also, consider adding a comment explaining why ZETA results in an unknown outbound type, if this is the intended behavior.
zetaclient/chains/evm/constant.go (1)
50-52
: Approve the addition ofTopicsGatewayDepositAndCall
constant.The new constant
TopicsGatewayDepositAndCall
is well-defined and consistent with the existing codebase. It enhances the system's capability to handle gateway deposit and call events.For improved consistency, consider adding a reference to the relevant smart contract file and line number in the comment, similar to other constants in this file.
// TopicsGatewayDepositAndCall is the number of topics for a gateway deposit and call event // [signature, sender, receiver] +// https://github.com/zeta-chain/protocol-contracts/blob/main/contracts/evm/ZetaGateway.sol#L<LINE_NUMBER> TopicsGatewayDepositAndCall = 3
cmd/zetae2e/local/v2.go (2)
29-30
: Approve addition of new test cases with a minor suggestion.The inclusion of
TestV2ETHDepositAndCallNoMessageName
andTestV2ETHWithdrawAndCallNoMessageName
aligns with the PR objectives and enhances test coverage for empty message scenarios.To improve clarity, consider adding a comment above these new test cases to explicitly state their purpose:
// Test cases for deposit and withdraw with empty messages e2etests.TestV2ETHDepositAndCallNoMessageName, e2etests.TestV2ETHWithdrawAndCallNoMessageName,This addition would enhance code readability and maintainability.
41-41
: Approve addition of new test case with a suggestion for completeness.The inclusion of
TestV2ERC20DepositAndCallNoMessageName
is appropriate and aligns with the PR objectives. However, for consistency with the ETH workflow, consider adding a corresponding test case for ERC20 withdrawal with an empty message:e2etests.TestV2ERC20DepositAndCallNoMessageName, e2etests.TestV2ERC20WithdrawAndCallNoMessageName,This addition would ensure comprehensive coverage of both deposit and withdrawal scenarios for ERC20 tokens with empty messages, maintaining parity with the ETH workflow testing.
x/crosschain/types/message_vote_inbound.go (2)
89-89
: Appropriate initialization of the new field.The
IsCrossChainCall
field is correctly initialized tofalse
, maintaining backward compatibility. To enhance code clarity, consider using a named constant for the default value:const DefaultIsCrossChainCall = false // In NewMsgVoteInbound IsCrossChainCall: DefaultIsCrossChainCall,This approach would improve readability and make it easier to update the default value if needed in the future.
Serialization Implications Identified for
MsgVoteInbound
The
IsCrossChainCall
field has been added to theMsgVoteInbound
struct; however, it is not reflected in the protobuf definitions or JSON marshaling. This omission can lead to serialization inconsistencies and potential runtime errors.
- Update Protobuf Definitions: Ensure that the
IsCrossChainCall
field is included in all relevant.proto
files.- Review JSON Marshaling: Verify and update JSON struct tags to incorporate the new field appropriately.
🔗 Analysis chain
Line range hint
41-89
: Consider additional validations and serialization implications.The introduction of the
IsCrossChainCall
field and its associated option function are well-implemented. However, there are two points to consider:
The
ValidateBasic
method hasn't been updated to include validation for the new field. Consider whether any validation is necessary for this field.The addition of a new field may have implications for serialization and deserialization, especially if this struct is used in network communications or persistent storage. Ensure that all serialization mechanisms (e.g., protobuf definitions, JSON marshaling) are updated accordingly.
To verify the serialization implications, you may want to run the following command:
This will help identify areas where serialization might need to be updated.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for protobuf definitions and JSON marshaling of MsgVoteInbound rg -A 10 "MsgVoteInbound" | rg "(proto|json)"Length of output: 11322
proto/zetachain/zetacore/crosschain/cross_chain_tx.proto (1)
46-49
: Approve the addition ofis_cross_chain_call
field with suggestions for improvement.The new field
is_cross_chain_call
is a suitable addition to support the PR objectives. However, consider the following recommendations:
- Enhance the comment for clarity:
// Indicates whether a smart contract call should be made for an inbound transaction. // This field is specifically used for assets in protocol contract version 2. bool is_cross_chain_call = 12;
- As per the past review comment, this field might be subject to future changes. Consider adding a TODO comment to track this:
// TODO: This field may be removed or generalized for all inbound transactions // in the future. Track progress at https://github.com/zeta-chain/node/issues/1949
- Ensure backwards compatibility is maintained when implementing logic related to this field.
x/crosschain/keeper/evm_deposit.go (1)
113-113
: Approve the addition ofIsCrossChainCall
parameter with a suggestion for clarity.The addition of
cctx.InboundParams.IsCrossChainCall
as a parameter toZRC20DepositAndCallContract
is appropriate and aligns with the PR objectives. This change enables the differentiation between standard deposits/withdrawals and those utilizingdepositAndCall
/withdrawAndCall
functionalities.To enhance code clarity, consider adding a brief comment explaining the purpose of this parameter:
// IsCrossChainCall indicates whether this is a cross-chain call (depositAndCall/withdrawAndCall) cctx.InboundParams.IsCrossChainCall,This addition will provide context for future developers working on this code.
pkg/contracts/testdappv2/TestDAppV2.abi (1)
127-145
: Approval:getNoMessageIndex
function addition is appropriate.The new
getNoMessageIndex
function aligns with the PR objectives by providing a mechanism to retrieve information about no-message calls for a specific address. The function signature and "pure" stateMutability are consistent with Solidity best practices.Consider adding inline documentation to clarify the purpose and expected return value of this function. For example:
/** * @dev Retrieves the index associated with no-message calls for a given address. * @param sender The address to query. * @return A string representing the no-message index for the given address. */ function getNoMessageIndex(address sender) external pure returns (string memory);e2e/runner/v2_zevm.go (3)
Line range hint
79-102
: Approve changes with minor suggestion for consistency.The implementation of
V2ETHWithdrawAndCallThroughContract
is well-structured and consistent with the overall design. It correctly uses theGatewayZEVMCaller
for contract interaction.For improved consistency with other functions in this file, consider adding a comment explaining the gas limit usage:
// This function may require more gas than the default limit previousGasLimit := r.ZEVMAuth.GasLimit r.ZEVMAuth.GasLimit = 10000000 defer func() { r.ZEVMAuth.GasLimit = previousGasLimit }()This change would align the gas handling with other functions like
V2ERC20WithdrawAndCall
.
Line range hint
123-152
: Approve changes with suggestion for improved clarity.The renaming of
V2ERC20WithdrawAndArbitraryCall
and its implementation are appropriate. The function correctly handles the increased gas limit requirement.To enhance code clarity, consider extracting the gas limit value to a named constant:
const highGasLimit = 10000000 // Usage r.ZEVMAuth.GasLimit = highGasLimitThis change would improve readability and make it easier to update the gas limit if needed in the future.
Line range hint
222-245
: Approve changes with suggestion for consistency.The implementation of
V2ZEVMToEMVCallThroughContract
is well-structured and correctly uses theGatewayZEVMCaller
for contract interaction.For consistency with other functions like
V2ETHWithdrawAndCallThroughContract
, consider adding a comment explaining the purpose of this function:// V2ZEVMToEMVCallThroughContract calls authenticated Call of Gateway on ZEVM through contract // This function facilitates cross-chain calls from ZEVM to EVM-compatible chainsThis addition would provide context and improve the overall documentation of the codebase.
proto/zetachain/zetacore/crosschain/tx.proto (1)
181-183
: Approve addition ofis_cross_chain_call
field with suggestion for improved documentation.The addition of the
is_cross_chain_call
boolean field to theMsgVoteInbound
message is appropriate and follows Protobuf best practices. This enhancement allows for clear indication of whether a smart contract call should be made with the asset, which is valuable for cross-chain operations.To further improve the code, consider adding a comment that provides more context about when this field should be set to true and its implications on the system's behavior.
Consider adding a descriptive comment above the field, such as:
// Indicates whether a smart contract call should be made with the asset. // Set to true for cross-chain contract calls, false for standard transfers. bool is_cross_chain_call = 19;x/fungible/keeper/v2_deposits_test.go (5)
18-50
: Approve implementation with minor enhancement suggestion.The
getTestDAppNoMessageIndex
function is well-structured and follows best practices for error handling and type assertion. To further enhance its robustness, consider adding a timeout mechanism to theCallEVM
function call to prevent potential blocking issues in case of network delays or contract execution problems.
141-152
: Approve test case with suggestion for additional assertions.The test case effectively covers the basic functionality of processing a deposit without a contract call. To enhance its comprehensiveness, consider adding assertions to verify:
- The state of other relevant contract variables or events that might be affected by the deposit.
- The gas consumption of the operation to ensure it remains within expected limits.
These additional checks would provide a more thorough validation of the deposit process.
Line range hint
154-186
: Enhance test case to verify message ignorance.While the test case correctly verifies the deposit process with a non-empty message, it could be strengthened by adding explicit checks to ensure the message is truly ignored. Consider the following enhancements:
- Add an assertion to verify that no event related to message processing is emitted.
- If applicable, check that any contract state that might be affected by message processing remains unchanged.
- Compare the gas consumption with the previous test case to ensure it's consistent, indicating that no additional processing occurred due to the presence of the message.
These additions would provide stronger evidence that the message is indeed ignored in this scenario.
Line range hint
188-222
: Enhance test coverage for deposit and call scenario.The test case effectively covers the basic flow of processing a deposit with a contract call. To improve its robustness and coverage, consider the following enhancements:
- Add assertions to verify the emitted events, ensuring they contain the correct information about the deposit and contract call.
- Include negative test cases, such as:
a. Attempting a deposit with insufficient balance.
b. Calling a non-existent contract method.
c. Passing invalid parameters to the contract call.- Verify the gas consumption of the operation to ensure it's within expected limits for a contract call scenario.
- Add a test case with a large deposit amount to check for potential overflow issues.
These additions would provide a more comprehensive test suite for the deposit and call functionality.
224-270
: Approve new test case with suggestions for enhancement.The test case effectively covers the new scenario of processing a deposit and call without a message, aligning well with the PR objectives. The use of
getTestDAppNoMessageIndex
and subsequent verification of the contract state are appropriate. To further strengthen this test, consider the following enhancements:
- Add assertions to verify that the correct events are emitted, including the absence of a message-related event.
- Include a check to ensure that the
messageIndex
is unique for each call, preventing potential conflicts.- Add a negative test case where
isCrossChainCall
is set tofalse
, to ensure the no-message index is not generated in this scenario.- Verify the gas consumption difference between this case and the case with a message, to ensure efficiency in handling no-message calls.
These additions would provide a more comprehensive validation of the new functionality.
docs/spec/crosschain/messages.md (2)
194-194
: Add description for the new field and improve formatting.The addition of the
is_cross_chain_call
field enhances the functionality for cross-chain calls, aligning with the PR objectives. However, to improve clarity and maintainability, consider the following suggestions:
- Add a brief description of the
is_cross_chain_call
field, explaining its purpose and usage.- For consistency with the rest of the document, replace the hard tab with spaces.
Here's a suggested improvement:
- bool is_cross_chain_call = 19; + bool is_cross_chain_call = 19; // Indicates whether this is a cross-chain call (e.g., depositAndCall or withdrawAndCall)🧰 Tools
🪛 Markdownlint
194-194: Column: 1
Hard tabs(MD010, no-hard-tabs)
194-194
: Update surrounding documentation to provide context for the new field.While the addition of the
is_cross_chain_call
field is appropriate, the surrounding documentation lacks context for this new functionality. To enhance clarity and maintainability, consider updating the documentation to:
- Explain the purpose of the
is_cross_chain_call
field in the context ofdepositAndCall
andwithdrawAndCall
operations.- Describe how this field affects the processing of inbound votes, especially when messages are empty.
- Provide an example or use case to illustrate when this field would be set to
true
.Here's a suggested addition to the documentation above the
MsgVoteInbound
definition:The `MsgVoteInbound` message now supports differentiation between standard deposits/withdrawals and cross-chain calls (e.g., `depositAndCall` and `withdrawAndCall`), even when the message field is empty. This is achieved through the `is_cross_chain_call` field.🧰 Tools
🪛 Markdownlint
194-194: Column: 1
Hard tabs(MD010, no-hard-tabs)
x/crosschain/types/cctx.go (1)
Line range hint
1-340
: Suggest comprehensive implementation of the new featureWhile the addition of the
IsCrossChainCall
field is a step in the right direction, the implementation appears incomplete. Consider the following suggestions to fully integrate this new feature:
- Update the
Validate()
method of theCrossChainTx
struct to include validation for the new field.- Modify relevant methods such as
AddRevertOutbound()
,AddOutbound()
, and others to utilize theIsCrossChainCall
information where appropriate.- Add unit tests to cover the new functionality and ensure proper handling of cross-chain calls.
- Update documentation throughout the file to reflect the new cross-chain call functionality.
Implementing these suggestions will ensure a more robust and complete integration of the new feature.
Would you like assistance in generating the code for these improvements?
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 240-240: x/crosschain/types/cctx.go#L240
Added line #L240 was not covered by testsx/crosschain/types/message_vote_inbound_test.go (1)
188-251
: Approve the new test case with a minor suggestion.The new test case effectively verifies the functionality of setting cross-chain call options in the
MsgVoteInbound
message. It covers all scenarios: default value, setting to true, and setting to false.Consider renaming the test case to be more specific:
-t.Run("can set is cross chain call options", func(t *testing.T) { +t.Run("verify cross chain call options default and setting", func(t *testing.T) {This name more accurately describes the test's purpose and aligns with best practices for test naming.
x/fungible/keeper/deposits_test.go (7)
48-48
: Approve changes with minor suggestion for clarityThe addition of the
false
parameter is correct and consistent with the updated method signature. However, to enhance code readability, consider using a named parameter:isCrossChainCall: false,This change would make the purpose of the boolean value more explicit to readers.
82-82
: Approve changes with suggestion for consistencyThe addition of the
false
parameter is correct. For consistency with the previous suggestion and to improve code clarity, consider using a named parameter:isCrossChainCall: false,This change would maintain a uniform style across all test cases.
116-116
: Approve changes with suggestion for consistencyThe addition of the
false
parameter is correct. To maintain consistency with previous suggestions and enhance code readability, consider using a named parameter:isCrossChainCall: false,This change would ensure a uniform style across all test cases and improve overall code clarity.
159-159
: Approve changes with suggestion for consistencyThe addition of the
false
parameter is correct. To maintain consistency with previous suggestions and improve code clarity, consider using a named parameter:isCrossChainCall: false,This change would ensure a uniform style across all test cases and enhance overall readability.
198-198
: Approve changes with suggestion for consistencyThe addition of the
false
parameter is correct. To maintain consistency with previous suggestions and enhance code clarity, consider using a named parameter:isCrossChainCall: false,This change would ensure a uniform style across all test cases and improve overall readability of the test suite.
241-241
: Approve changes with suggestion for consistencyThe addition of the
false
parameter is correct. To maintain consistency with previous suggestions and improve code clarity, consider using a named parameter:isCrossChainCall: false,This change would ensure a uniform style across all test cases and enhance the overall readability of the test suite.
269-269
: Approve changes with suggestion for consistencyThe addition of the
false
parameter is correct. To maintain consistency with previous suggestions and enhance code clarity, consider using a named parameter:isCrossChainCall: false,This change would ensure a uniform style across all test cases and improve the overall readability of the test suite.
testutil/keeper/crosschain.go (2)
Line range hint
393-401
: Approve addition with minor enhancement suggestion.The
MockRevertForHandleEVMDeposit
function effectively simulates a failed deposit operation. Consider adding a comment explaining the purpose of this mock function for improved code documentation.+// MockRevertForHandleEVMDeposit simulates a failed ZRC20 deposit operation for testing purposes func MockRevertForHandleEVMDeposit( m *crosschainmocks.CrosschainFungibleKeeper, receiver ethcommon.Address, amount *big.Int, senderChainID int64, errDeposit error, ) {
Line range hint
413-421
: Approve changes to MockVoteOnOutboundFailedBallot with refactoring suggestion.The modifications to
MockVoteOnOutboundFailedBallot
mirror those made toMockVoteOnOutboundSuccessBallot
, enhancing testing flexibility. Consider refactoring these two functions to reduce code duplication, as they share similar structures and differ primarily in theReceiveStatus
parameter.Example refactoring:
func mockVoteOnOutboundBallot( m *crosschainmocks.CrosschainObserverKeeper, ctx sdk.Context, cctx *types.CrossChainTx, senderChain chains.Chain, observer string, status chains.ReceiveStatus, ballotStatus observertypes.BallotStatus, ) { m.On("VoteOnOutboundBallot", ctx, mock.Anything, cctx.GetCurrentOutboundParam().ReceiverChainId, status, observer). Return(true, true, observertypes.Ballot{BallotStatus: ballotStatus}, senderChain.Name, nil). Once() } // Then use it like this: func MockVoteOnOutboundSuccessBallot(...) { mockVoteOnOutboundBallot(..., chains.ReceiveStatus_success, observertypes.BallotStatus_BallotFinalized_SuccessObservation) } func MockVoteOnOutboundFailedBallot(...) { mockVoteOnOutboundBallot(..., chains.ReceiveStatus_failed, observertypes.BallotStatus_BallotFinalized_FailureObservation) }pkg/contracts/testdappv2/TestDAppV2.json (3)
3-15
: Approve addition ofNO_MESSAGE_CALL
functionThe new
NO_MESSAGE_CALL
function aligns with the PR objective of supportingdepositAndCall
andwithdrawAndCall
with empty messages. Its view state mutability ensures it doesn't modify the contract state.Consider adding a NatSpec comment to document the purpose and return value of this function for improved clarity and maintainability.
128-146
: Approve addition ofgetNoMessageIndex
functionThe new
getNoMessageIndex
function complements theNO_MESSAGE_CALL
function in handling empty message scenarios. Its pure state mutability ensures it doesn't read or modify the contract state.Consider adding a NatSpec comment to document the purpose, parameter, and return value of this function for improved clarity and maintainability.
Implement Comprehensive Tests for New Functions
The newly added
NO_MESSAGE_CALL
andgetNoMessageIndex
functions lack corresponding test cases. To ensure their correct integration and functionality, it is essential to develop dedicated tests covering various scenarios, including edge cases and interactions with existing functions likedepositAndCall
andwithdrawAndCall
.
- Develop test cases for
NO_MESSAGE_CALL
andgetNoMessageIndex
.- Ensure integration tests validate their behavior within
depositAndCall
andwithdrawAndCall
operations.- Cover edge cases such as empty messages and incorrect inputs to verify robustness.
🔗 Analysis chain
Line range hint
1-295
: Approve contract modifications and suggest comprehensive testingThe additions of
NO_MESSAGE_CALL
andgetNoMessageIndex
functions enhance the contract's capability to handle empty message scenarios, aligning with the PR objectives. These view and pure functions maintain the contract's overall behavior while extending its functionality.Ensure comprehensive testing of the new functions and their integration with existing functionality, particularly in scenarios involving
depositAndCall
andwithdrawAndCall
with empty messages. Consider the following verification steps:
- Test
NO_MESSAGE_CALL
in various contexts.- Verify
getNoMessageIndex
with different sender addresses.- Integrate these functions with
depositAndCall
andwithdrawAndCall
operations.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the integration of new functions with existing functionality # Search for test files related to depositAndCall and withdrawAndCall echo "Searching for relevant test files:" fd -e js -e ts -e sol --exec grep -Hn 'depositAndCall|withdrawAndCall|NO_MESSAGE_CALL|getNoMessageIndex' {} # Look for any TODOs or FIXMEs related to empty message handling echo "Checking for TODOs or FIXMEs related to empty message handling:" rg -i 'TODO|FIXME' -A 3 -B 3 | rg -i 'empty.?message|no.?message'Length of output: 395
Script:
#!/bin/bash # Broadening the search for test cases related to new functions # Search for any test files that mention the new functions echo "Searching for test cases covering NO_MESSAGE_CALL and getNoMessageIndex:" fd -e js -e ts -e sol -g '*test*.js' --exec grep -Hn 'NO_MESSAGE_CALL\|getNoMessageIndex' {} \; # Search for tests related to depositAndCall and withdrawAndCall with empty messages echo "Searching for tests related to depositAndCall and withdrawAndCall handling empty messages:" fd -e js -e ts -e sol -g '*test*.js' --exec grep -i -Hn 'depositAndCall.*empty message\|withdrawAndCall.*empty message' {} \; # Verify if there are any generic tests handling empty messages echo "Searching for generic tests handling empty messages:" fd -e js -e ts -e sol -g '*test*.js' --exec grep -i -Hn 'empty message\|no message\|handle empty' {} \;Length of output: 801
Script:
#!/bin/bash # Expanding the search for test cases related to new functions # Search for test files with various naming conventions and extensions echo "Searching for test cases covering NO_MESSAGE_CALL and getNoMessageIndex with broader patterns:" fd -e js -e ts -e sol -e jsx -e tsx -e py -g '*test*' --exec grep -Hn 'NO_MESSAGE_CALL\|getNoMessageIndex' {} \; # Search for any usage of the new functions within the codebase echo "Searching for any usage of NO_MESSAGE_CALL and getNoMessageIndex in the codebase:" rg -i 'NO_MESSAGE_CALL|getNoMessageIndex' # Use ast-grep to find implementations or references of the new functions echo "Using ast-grep to locate implementations of NO_MESSAGE_CALL and getNoMessageIndex:" ast-grep --pattern 'function NO_MESSAGE_CALL($_) { $$$ }' . ast-grep --pattern 'function getNoMessageIndex($_) { $$$ }' .Length of output: 9146
go.mod (1)
Assess Maintenance of Forked Dependencies
github.com/bnb-chain/tss-lib
last updated on 2024-01-26github.com/ethereum/go-ethereum
last updated on 2024-07-18github.com/libp2p/go-libp2p
last updated on 2024-07-30gitlab.com/thorchain/tss/go-tss
last updated on 2024-09-19The
tss-lib
dependency has not been updated since January 2024, which may lead to discrepancies with upstream changes and potential security vulnerabilities. It is recommended to review the maintenance status of this fork and ensure it aligns with project requirements.🔗 Analysis chain
Line range hint
392-399
: Verify maintenance of forked dependencies.Several dependencies are being replaced with forks maintained by ZetaChain:
github.com/bnb-chain/tss-lib
github.com/ethereum/go-ethereum
github.com/libp2p/go-libp2p
gitlab.com/thorchain/tss/go-tss
While using forks allows for custom modifications, it's crucial to ensure these forks are regularly updated to incorporate upstream changes and security patches.
To verify the last update times of these forks, please run the following script:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check the last commit dates of the ZetaChain forks. echo "Checking last commit dates of ZetaChain forks:" for repo in "tss-lib" "go-ethereum" "go-libp2p" "go-tss"; do echo "$repo:" gh repo view zeta-chain/$repo --json updatedAt --jq .updatedAt echo doneLength of output: 837
x/crosschain/keeper/evm_deposit_test.go (2)
Line range hint
102-110
: LGTM. Consider adding a comment for the new parameter.The addition of the new
mock.Anything
parameter aligns with the PR objectives. To enhance code readability, consider adding a comment explaining the purpose of this new parameter.
Line range hint
556-564
: LGTM. Consider updating the comment for consistency.The changes to this test case are consistent with the previous modifications. For improved consistency, consider updating the comment above the
ZRC20DepositAndCallContract
mock function call to reflect the new parameter.testutil/keeper/mocks/crosschain/fungible.go (1)
Line range hint
700-734
: Approve changes with a minor suggestion for improved readability.The implementation of
ZRC20DepositAndCallContract
correctly incorporates the newisCrossChainCall
parameter, aligning with the PR objectives. The changes are well-structured and consistent with the existing codebase.To enhance readability, consider breaking down the long parameter list using line breaks and alignment:
func (_m *CrosschainFungibleKeeper) ZRC20DepositAndCallContract( ctx types.Context, from []byte, to common.Address, amount *big.Int, senderChainID int64, data []byte, coinType coin.CoinType, asset string, protocolContractVersion crosschaintypes.ProtocolContractVersion, isCrossChainCall bool, ) (*evmtypes.MsgEthereumTxResponse, bool, error) { // ... rest of the implementation }This formatting improves code readability without changing functionality.
e2e/e2etests/e2etests.go (1)
786-793
: Consistent addition of new E2ETests for V2 withdrawals with no message.The new E2ETests for V2 ETH and ERC20 withdrawal and call with no message content are well-structured and maintain consistency with existing tests. The descriptions accurately reflect their purposes.
However, for improved consistency:
Consider adding a default amount for the ERC20 withdrawal test, similar to the ETH withdrawal test:
runner.NewE2ETest( TestV2ERC20WithdrawAndCallNoMessageName, "withdraw ERC20 from ZEVM and authenticated call a contract using V2 contract with no message", - []runner.ArgDefinition{}, + []runner.ArgDefinition{ + {Description: "amount", DefaultValue: "1000"}, + }, TestV2ERC20WithdrawAndCallNoMessage, ),Also applies to: 880-885
testutil/sample/crosschain.go (1)
317-318
: Approve renaming ofGetValidZRC20WithdrawToETH
with a minor suggestion.The renaming of
GetValidZRC20WithdrawToETH
toValidZrc20WithdrawToETHReceipt
improves code clarity and maintains consistency with other function names. However, there's a minor inconsistency in the capitalization of "Zrc20".Consider updating the function name to
ValidZRC20WithdrawToETHReceipt
for consistent capitalization of "ZRC20".changelog.md (1)
57-57
: Consider renaming event names for consistencyThe event names
DepositedAndCalled
andWithdrawedAndCalled
are grammatically inconsistent. Consider renamingWithdrawedAndCalled
toWithdrawnAndCalled
for better grammatical consistency and clarity.x/fungible/keeper/v2_deposits.go (1)
31-31
: Clarify the initialization ofOrigin
to an empty byte sliceSetting
context.Origin
to[]byte{}
may benefit from an explanatory comment. If this is intentional to reflect a specific context where the origin is undefined or irrelevant, documenting the rationale will enhance code readability and assist future developers.x/crosschain/types/inbound_parsing.go (2)
104-107
: Nitpick: Document the parameters and error casesThe inbound message constructor functions lack detailed documentation for their parameters and potential error cases. Providing comprehensive comments improves code readability and maintainability.
Enhance the function comments to include descriptions of each parameter and the conditions under which errors are returned. For example:
// NewWithdrawalInbound creates a new inbound message for a withdrawal. // // Parameters: // - ctx: The context of the operation. // - txOrigin: The original transaction sender. // - foreignCoin: The foreign coin details. // - event: The parsed withdrawal event. // - receiverChain: The chain where the funds are received. // - gasLimitQueried: The queried gas limit if not specified in the event. // // Returns: // - A pointer to MsgVoteInbound if successful. // - An error if any parameter is invalid or an operation fails.Also applies to: 159-162, 207-210
3-18
: Nitpick: Organize imports for clarityThe import statements can be organized into standard, third-party, and local packages to improve readability.
Group the imports as follows:
import ( "encoding/hex" "math/big" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pkg/errors" "github.com/ethereum/go-ethereum/accounts/abi/bind" ethcommon "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/zeta-chain/node/pkg/chains" "github.com/zeta-chain/node/pkg/coin" fungibletypes "github.com/zeta-chain/node/x/fungible/types" "github.com/zeta-chain/protocol-contracts/v2/pkg/gatewayzevm.sol" )pkg/contracts/testdappv2/TestDAppV2.go (1)
225-240
: Consider handling potential errors more gracefullyIn the implementations of
NOMESSAGECALL
andGetNoMessageIndex
, any errors returned from the contract call are directly returned. Evaluate the necessity of additional error handling or custom error messages to provide clearer insights during failures.Also applies to: 380-395
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 228-234: pkg/contracts/testdappv2/TestDAppV2.go#L228-L234
Added lines #L228 - L234 were not covered by tests
[warning] 236-238: pkg/contracts/testdappv2/TestDAppV2.go#L236-L238
Added lines #L236 - L238 were not covered by tests
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
⛔ Files ignored due to path filters (6)
go.sum
is excluded by!**/*.sum
pkg/contracts/testdappv2/TestDAppV2.bin
is excluded by!**/*.bin
typescript/zetachain/zetacore/crosschain/cross_chain_tx_pb.d.ts
is excluded by!**/*_pb.d.ts
typescript/zetachain/zetacore/crosschain/tx_pb.d.ts
is excluded by!**/*_pb.d.ts
x/crosschain/types/cross_chain_tx.pb.go
is excluded by!**/*.pb.go
,!**/*.pb.go
x/crosschain/types/tx.pb.go
is excluded by!**/*.pb.go
,!**/*.pb.go
📒 Files selected for processing (43)
- changelog.md (1 hunks)
- cmd/zetae2e/local/v2.go (2 hunks)
- docs/openapi/openapi.swagger.yaml (1 hunks)
- docs/spec/crosschain/messages.md (1 hunks)
- e2e/e2etests/e2etests.go (5 hunks)
- e2e/e2etests/test_v2_erc20_deposit_and_call.go (1 hunks)
- e2e/e2etests/test_v2_erc20_deposit_and_call_no_message.go (1 hunks)
- e2e/e2etests/test_v2_erc20_deposit_and_call_revert.go (1 hunks)
- e2e/e2etests/test_v2_erc20_deposit_and_call_revert_with_call.go (1 hunks)
- e2e/e2etests/test_v2_erc20_withdraw_and_call_no_message.go (1 hunks)
- e2e/e2etests/test_v2_eth_deposit_and_call_no_message.go (1 hunks)
- e2e/e2etests/test_v2_eth_withdraw_and_call_no_message.go (1 hunks)
- e2e/runner/v2_zevm.go (4 hunks)
- go.mod (1 hunks)
- pkg/contracts/testdappv2/TestDAppV2.abi (2 hunks)
- pkg/contracts/testdappv2/TestDAppV2.go (3 hunks)
- pkg/contracts/testdappv2/TestDAppV2.json (3 hunks)
- pkg/contracts/testdappv2/TestDAppV2.sol (5 hunks)
- pkg/contracts/testdappv2/bindings.go (1 hunks)
- proto/zetachain/zetacore/crosschain/cross_chain_tx.proto (1 hunks)
- proto/zetachain/zetacore/crosschain/tx.proto (1 hunks)
- testutil/keeper/crosschain.go (1 hunks)
- testutil/keeper/mocks/crosschain/fungible.go (2 hunks)
- testutil/sample/crosschain.go (1 hunks)
- x/crosschain/keeper/evm_deposit.go (1 hunks)
- x/crosschain/keeper/evm_deposit_test.go (10 hunks)
- x/crosschain/keeper/evm_hooks_test.go (34 hunks)
- x/crosschain/keeper/v2_zevm_inbound.go (3 hunks)
- x/crosschain/types/cctx.go (1 hunks)
- x/crosschain/types/expected_keepers.go (1 hunks)
- x/crosschain/types/inbound_parsing.go (1 hunks)
- x/crosschain/types/inbound_parsing_test.go (1 hunks)
- x/crosschain/types/message_vote_inbound.go (2 hunks)
- x/crosschain/types/message_vote_inbound_test.go (1 hunks)
- x/fungible/keeper/deposits.go (2 hunks)
- x/fungible/keeper/deposits_test.go (11 hunks)
- x/fungible/keeper/v2_deposits.go (1 hunks)
- x/fungible/keeper/v2_deposits_test.go (4 hunks)
- zetaclient/chains/evm/cctx.go (2 hunks)
- zetaclient/chains/evm/cctx_test.go (1 hunks)
- zetaclient/chains/evm/constant.go (1 hunks)
- zetaclient/chains/evm/observer/inbound.go (2 hunks)
- zetaclient/chains/evm/observer/v2_inbound.go (3 hunks)
✅ Files skipped from review due to trivial changes (2)
- e2e/e2etests/test_v2_erc20_deposit_and_call_revert.go
- e2e/e2etests/test_v2_erc20_deposit_and_call_revert_with_call.go
🧰 Additional context used
📓 Path-based instructions (34)
cmd/zetae2e/local/v2.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.e2e/e2etests/e2etests.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.e2e/e2etests/test_v2_erc20_deposit_and_call.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.e2e/e2etests/test_v2_erc20_deposit_and_call_no_message.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.e2e/e2etests/test_v2_erc20_withdraw_and_call_no_message.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.e2e/e2etests/test_v2_eth_deposit_and_call_no_message.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.e2e/e2etests/test_v2_eth_withdraw_and_call_no_message.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.e2e/runner/v2_zevm.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.pkg/contracts/testdappv2/TestDAppV2.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.pkg/contracts/testdappv2/bindings.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.proto/zetachain/zetacore/crosschain/cross_chain_tx.proto (1)
Pattern
**/*.proto
: Review the Protobuf definitions, point out issues relative to compatibility, and expressiveness.proto/zetachain/zetacore/crosschain/tx.proto (1)
Pattern
**/*.proto
: Review the Protobuf definitions, point out issues relative to compatibility, and expressiveness.testutil/keeper/crosschain.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.testutil/keeper/mocks/crosschain/fungible.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.testutil/sample/crosschain.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/keeper/evm_deposit.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/keeper/evm_deposit_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/keeper/evm_hooks_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/keeper/v2_zevm_inbound.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/types/cctx.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/types/expected_keepers.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/types/inbound_parsing.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/types/inbound_parsing_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/types/message_vote_inbound.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/types/message_vote_inbound_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/fungible/keeper/deposits.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/fungible/keeper/deposits_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/fungible/keeper/v2_deposits.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/fungible/keeper/v2_deposits_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/evm/cctx.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/evm/cctx_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/evm/constant.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/evm/observer/inbound.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/evm/observer/v2_inbound.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.
🪛 Markdownlint
docs/spec/crosschain/messages.md
194-194: Column: 1
Hard tabs(MD010, no-hard-tabs)
🪛 GitHub Check: codecov/patch
pkg/contracts/testdappv2/TestDAppV2.go
[warning] 228-234: pkg/contracts/testdappv2/TestDAppV2.go#L228-L234
Added lines #L228 - L234 were not covered by tests
[warning] 236-238: pkg/contracts/testdappv2/TestDAppV2.go#L236-L238
Added lines #L236 - L238 were not covered by tests
[warning] 245-246: pkg/contracts/testdappv2/TestDAppV2.go#L245-L246
Added lines #L245 - L246 were not covered by tests
[warning] 252-253: pkg/contracts/testdappv2/TestDAppV2.go#L252-L253
Added lines #L252 - L253 were not covered by tests
[warning] 383-389: pkg/contracts/testdappv2/TestDAppV2.go#L383-L389
Added lines #L383 - L389 were not covered by tests
[warning] 391-393: pkg/contracts/testdappv2/TestDAppV2.go#L391-L393
Added lines #L391 - L393 were not covered by tests
[warning] 400-401: pkg/contracts/testdappv2/TestDAppV2.go#L400-L401
Added lines #L400 - L401 were not covered by tests
[warning] 407-408: pkg/contracts/testdappv2/TestDAppV2.go#L407-L408
Added lines #L407 - L408 were not covered by testsx/crosschain/keeper/v2_zevm_inbound.go
[warning] 40-41: x/crosschain/keeper/v2_zevm_inbound.go#L40-L41
Added lines #L40 - L41 were not covered by tests
[warning] 43-49: x/crosschain/keeper/v2_zevm_inbound.go#L43-L49
Added lines #L43 - L49 were not covered by tests
[warning] 54-54: x/crosschain/keeper/v2_zevm_inbound.go#L54
Added line #L54 was not covered by tests
[warning] 61-75: x/crosschain/keeper/v2_zevm_inbound.go#L61-L75
Added lines #L61 - L75 were not covered by tests
[warning] 84-103: x/crosschain/keeper/v2_zevm_inbound.go#L84-L103
Added lines #L84 - L103 were not covered by tests
[warning] 108-115: x/crosschain/keeper/v2_zevm_inbound.go#L108-L115
Added lines #L108 - L115 were not covered by testsx/crosschain/types/cctx.go
[warning] 240-240: x/crosschain/types/cctx.go#L240
Added line #L240 was not covered by testsx/crosschain/types/inbound_parsing.go
[warning] 24-44: x/crosschain/types/inbound_parsing.go#L24-L44
Added lines #L24 - L44 were not covered by tests
[warning] 52-59: x/crosschain/types/inbound_parsing.go#L52-L59
Added lines #L52 - L59 were not covered by tests
[warning] 61-61: x/crosschain/types/inbound_parsing.go#L61
Added line #L61 was not covered by tests
[warning] 69-77: x/crosschain/types/inbound_parsing.go#L69-L77
Added lines #L69 - L77 were not covered by tests
[warning] 85-93: x/crosschain/types/inbound_parsing.go#L85-L93
Added lines #L85 - L93 were not covered by tests
[warning] 113-116: x/crosschain/types/inbound_parsing.go#L113-L116
Added lines #L113 - L116 were not covered by tests
[warning] 118-121: x/crosschain/types/inbound_parsing.go#L118-L121
Added lines #L118 - L121 were not covered by tests
[warning] 124-127: x/crosschain/types/inbound_parsing.go#L124-L127
Added lines #L124 - L127 were not covered by tests
[warning] 129-148: x/crosschain/types/inbound_parsing.go#L129-L148
Added lines #L129 - L148 were not covered by tests
[warning] 168-171: x/crosschain/types/inbound_parsing.go#L168-L171
Added lines #L168 - L171 were not covered by tests
[warning] 173-176: x/crosschain/types/inbound_parsing.go#L173-L176
Added lines #L173 - L176 were not covered by tests
[warning] 178-196: x/crosschain/types/inbound_parsing.go#L178-L196
Added lines #L178 - L196 were not covered by tests
[warning] 216-219: x/crosschain/types/inbound_parsing.go#L216-L219
Added lines #L216 - L219 were not covered by tests
[warning] 221-224: x/crosschain/types/inbound_parsing.go#L221-L224
Added lines #L221 - L224 were not covered by tests
[warning] 226-245: x/crosschain/types/inbound_parsing.go#L226-L245
Added lines #L226 - L245 were not covered by tests
🔇 Additional comments (64)
e2e/e2etests/test_v2_erc20_deposit_and_call.go (1)
40-40
: Approve: Log message accurately reflects the operation.The update to the log message from "deposit" to "deposit_and_call" is appropriate and aligns with the function's purpose. This change enhances clarity and accurately represents the operation being performed.
e2e/e2etests/test_v2_eth_deposit_and_call_no_message.go (1)
32-35
: Transaction mining and status check implementation is robust.The implementation for waiting on the cross-chain transaction to be mined and checking its status is well-structured. The use of
WaitCctxMinedByInboundHash
ensures the transaction is processed before proceeding, and the subsequent status check verifies the expected outcome. The logging of the cctx details provides valuable information for debugging purposes.x/crosschain/types/inbound_parsing_test.go (1)
3-11
: Import statements are well-organized and appropriate.The import statements are correctly grouped and include all necessary packages for the test file.
zetaclient/chains/evm/cctx.go (1)
50-53
: Improved logic for determining outbound type.The modification enhances the determination of the outbound type for gas transactions. By utilizing the
IsCrossChainCall
flag, the function now explicitly differentiates between standard withdrawals and withdraw-and-call operations, regardless of the message content. This change aligns with the PR objectives and improves code clarity.zetaclient/chains/evm/cctx_test.go (2)
3-10
: Import statements are appropriate and well-organized.The import statements are correctly structured, following Go conventions with standard library imports preceding third-party packages. All imported packages are relevant to the test file's functionality.
12-104
: Test function structure adheres to best practices.The
TestParseOutboundTypeFromCCTX
function employs a table-driven test approach, which is an excellent practice for comprehensive scenario testing. The use of subtests viat.Run
enhances test organization and isolation. This structure facilitates easy addition of new test cases and improves test readability.cmd/zetae2e/local/v2.go (1)
Line range hint
1-141
: Summary of review forcmd/zetae2e/local/v2.go
The changes in this file effectively enhance test coverage for handling empty messages in
depositAndCall
andwithdrawAndCall
operations, aligning well with the PR objectives. The new test cases are appropriately integrated into the existing parallel execution structure and follow consistent naming conventions.Key points:
- New test cases for ETH workflow with empty messages have been added.
- A new test case for ERC20 deposit with empty message has been added.
- Consider adding a comment for clarity above the new ETH test cases.
- For completeness, consider adding an ERC20 withdrawal test case with empty message.
These changes contribute to a more robust testing suite, ensuring the reliability of the new empty message handling functionality.
x/crosschain/types/message_vote_inbound.go (1)
41-46
: Commendable implementation of the option pattern.The
WithCrossChainCall
function is a well-structured option setter for theMsgVoteInbound
struct. It adheres to Go's idiomatic practices and provides a clear, concise way to set theIsCrossChainCall
field.x/fungible/keeper/deposits.go (2)
48-58
: Approve: Updated ProcessV2Deposit function callThe modification to include the
isCrossChainCall
parameter in theProcessV2Deposit
function call is correct and consistent with the changes in the function signature. This change appropriately handles the new parameter for V2 protocol contracts while maintaining backward compatibility.
Line range hint
38-58
: Summary: Effective implementation of cross-chain call supportThe changes to the
ZRC20DepositAndCallContract
function effectively implement support for differentiating between standard deposits and cross-chain calls. The modification is well-structured, maintains backward compatibility, and aligns with the PR objectives. The implementation is clean and doesn't introduce unnecessary complexity.To further enhance the code:
- Consider adding documentation for the new
isCrossChainCall
parameter.- Ensure that all calls to this function across the codebase have been updated accordingly.
Overall, the changes provide a solid foundation for handling cross-chain calls in the ZetaChain ecosystem.
pkg/contracts/testdappv2/TestDAppV2.abi (2)
2-14
: Approval:NO_MESSAGE_CALL
function addition is appropriate.The new
NO_MESSAGE_CALL
function aligns with the PR objectives by providing a mechanism to handle calls with no message. The function signature and "view" stateMutability are consistent with Solidity best practices.
Line range hint
1-145
: Summary: ABI changes align with PR objectives.The additions to the TestDAppV2 ABI, namely the
NO_MESSAGE_CALL
andgetNoMessageIndex
functions, are well-aligned with the PR objectives of supportingdepositAndCall
andwithdrawAndCall
with empty messages. These minimal, focused changes enhance the contract's capability to handle no-message scenarios without modifying existing functionality, thus maintaining backward compatibility and reducing the risk of regression.e2e/runner/v2_zevm.go (1)
Line range hint
1-245
: Overall assessment: Changes align with PR objectives and improve code clarity.The modifications in this file successfully address the PR objectives by introducing new functions and renaming existing ones to support
depositAndCall
andwithdrawAndCall
with empty messages. The changes maintain consistency in error handling and gas limit management across functions.Key improvements:
- Clear distinction between arbitrary and authenticated calls.
- Introduction of contract-based interactions using
GatewayZEVMCaller
.- Consistent handling of increased gas limits for complex operations.
These changes enhance the functionality and clarity of the ZetaChain node's interaction with the ZEVM gateway. To further improve the codebase, consider implementing the suggested minor enhancements for consistency and clarity across all functions.
x/fungible/keeper/v2_deposits_test.go (1)
Line range hint
1-270
: Comprehensive test suite with room for minor enhancements.The modifications to
v2_deposits_test.go
significantly improve the test coverage for theProcessV2Deposit
function, aligning well with the PR objectives. The new helper function and test cases effectively address the handling of deposits with and without messages, including cross-chain calls.To further elevate the quality of this test suite:
- Consider implementing property-based testing for more exhaustive coverage of edge cases.
- Enhance error case handling across all test scenarios.
- Implement consistent gas consumption checks to ensure efficiency.
- Add more granular event verification in all test cases.
These enhancements would result in a more robust and comprehensive test suite, providing stronger guarantees for the correct functioning of the deposit processing logic.
x/crosschain/types/cctx.go (1)
240-240
: Approve addition ofIsCrossChainCall
field with suggestions for improvementThe addition of the
IsCrossChainCall
field to theInboundParams
struct aligns with the PR objectives and enhances the cross-chain functionality. However, consider the following improvements:
- Add validation for this new field in the
Validate()
method ofInboundParams
.- Update relevant methods within this file to utilize this new field where appropriate.
- Consider adding documentation to explain the purpose and usage of this field.
To ensure consistent usage across the codebase, run the following script:
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 240-240: x/crosschain/types/cctx.go#L240
Added line #L240 was not covered by testsx/fungible/keeper/deposits_test.go (2)
403-403
: Approve changes with suggestion for consistency and emphasis on V2 testingThe addition of the
false
parameter is correct and crucial for testing the V2 functionality. To maintain consistency with previous suggestions and improve code clarity, consider using a named parameter:isCrossChainCall: false,This change would ensure a uniform style across all test cases and enhance the overall readability of the test suite.
Additionally, given the importance of V2 functionality mentioned in the PR objectives, consider adding more comprehensive test cases for V2 deposits, including scenarios with
isCrossChainCall
set totrue
.
Line range hint
1-458
: Summary of changes and suggestions for improvementThe modifications to add the
isCrossChainCall
parameter to allZRC20DepositAndCallContract
method calls are consistent and align with the PR objectives. To further enhance the test suite:
- Consider using named parameters for the
isCrossChainCall
argument across all test cases to improve readability.- Add more comprehensive test cases for V2 functionality, including scenarios where
isCrossChainCall
is set totrue
.- Ensure that edge cases and potential failure scenarios for cross-chain calls are adequately covered in the test suite.
These improvements will enhance the overall quality and coverage of the test suite, ensuring robust functionality of the
ZRC20DepositAndCallContract
method.testutil/keeper/crosschain.go (1)
Line range hint
403-411
: Approve changes to MockVoteOnOutboundSuccessBallot.The modifications to
MockVoteOnOutboundSuccessBallot
enhance its flexibility by introducing theobserver
parameter. This change allows for more comprehensive testing scenarios, particularly in simulating different observer behaviors.go.mod (3)
Line range hint
3-5
: Toolchain update approved.The Go toolchain version has been updated from 1.22.2 to 1.22.5. This minor version update is beneficial as it likely includes bug fixes and security improvements.
Line range hint
1-399
: Summary of changes and recommendations.The
go.mod
file has undergone significant updates:
- Go toolchain version updated to 1.22.5.
- New dependencies added and existing ones updated.
- Several dependencies replaced with ZetaChain-maintained forks.
Recommendations:
- Ensure all new dependencies are necessary and align with the project's objectives.
- Regularly update and maintain the ZetaChain forks to incorporate upstream changes.
- Update the project documentation to reflect these dependency changes, if applicable.
- Consider running a thorough test suite to ensure compatibility with the updated dependencies.
62-62
: New dependencies and version updates noted.The
github.com/zeta-chain/protocol-contracts
dependency has been updated to a newer version. Additionally, new dependencies have been introduced:
github.com/bnb-chain/tss-lib v1.5.0
github.com/showa-93/go-mask v0.6.2
github.com/tonkeeper/tongo v1.9.3
Please ensure that these new dependencies are necessary and that their introduction aligns with the project's objectives.
To verify the usage of these new dependencies, please run the following script:
Also applies to: 370-374
✅ Verification successful
New dependencies are appropriately integrated and utilized.
All newly introduced dependencies are actively used across various components of the codebase, ensuring they are necessary and align with the project's objectives.
github.com/bnb-chain/tss-lib
is used in:
zetaclient/tss/tss_signer.go
cmd/zetaclientd/gen_pre_params.go
cmd/zetaclientd/main.go
github.com/showa-93/go-mask
is used in:
zetaclient/config/types.go
github.com/tonkeeper/tongo
is extensively used in multiple files including orchestrators, test utilities, and contract modules.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for the usage of new dependencies in the codebase. echo "Checking usage of new dependencies:" for dep in "github.com/bnb-chain/tss-lib" "github.com/showa-93/go-mask" "github.com/tonkeeper/tongo"; do echo "Usage of $dep:" rg --type go "$dep" echo doneLength of output: 4856
Script:
#!/bin/bash # Description: Analyze detailed usage of new dependencies in the codebase. echo "Analyzing imports for github.com/bnb-chain/tss-lib:" rg --type go 'import\s+"github.com/bnb-chain/tss-lib"' --context 2 echo echo "Analyzing imports for github.com/showa-93/go-mask:" rg --type go 'import\s+"github.com/showa-93/go-mask"' --context 2 echo echo "Analyzing imports for github.com/tonkeeper/tongo:" rg --type go 'import\s+"github.com/tonkeeper/tongo' --context 2 echo echo "Identifying specific functions from github.com/bnb-chain/tss-lib:" rg --type go 'tss-lib/[^ ]+' echo echo "Identifying specific functions from github.com/showa-93/go-mask:" rg --type go 'go-mask/[^ ]+' echo echo "Identifying specific functions from github.com/tonkeeper/tongo:" rg --type go 'tongo/[^ ]+' echoLength of output: 5092
x/crosschain/keeper/evm_deposit_test.go (6)
Line range hint
149-157
: LGTM. Changes are consistent.The modification to the
ZRC20DepositAndCallContract
mock function call is consistent with the previous test case and aligns with the PR objectives.
Line range hint
213-221
: LGTM. Consistent implementation.The changes to this test case are consistent with the previous modifications and align with the PR objectives.
Line range hint
304-312
: LGTM. Consistent modification.The changes to this test case maintain consistency with the previous modifications and align with the PR objectives.
Line range hint
350-358
: LGTM. Consistent implementation.The modifications to this test case are in line with the previous changes and adhere to the PR objectives.
Line range hint
395-403
: LGTM. Consistent modification.The changes to this test case maintain consistency with the previous modifications and align with the PR objectives.
Line range hint
1-611
: Overall, the changes are consistent and improve test coverage.The modifications to this test file are consistent across all test cases and align well with the PR objectives. The addition of the new parameter to the
ZRC20DepositAndCallContract
mock function calls reflects the changes made to the underlying implementation. These updates enhance the test coverage for the new functionality introduced in the PR, particularly the support fordepositAndCall
andwithdrawAndCall
with empty messages.e2e/e2etests/e2etests.go (3)
133-139
: Appropriate addition of new constants.The new constants for V2 ETH deposit and withdrawal with no message are well-placed and follow the existing naming convention.
145-151
: Consistent addition of new ERC20 constants.The new constants for V2 ERC20 deposit and withdrawal with no message maintain consistency with the existing naming convention and are correctly positioned within the V2 smart contract tests section.
738-745
: Well-structured new E2ETest for V2 ETH deposit and call with no message.The new E2ETest for V2 ETH deposit and call with no message content is correctly structured and maintains consistency with existing tests. The description and default value are appropriate.
testutil/sample/crosschain.go (4)
308-310
: Approve renaming ofGetInvalidZRC20WithdrawToExternal
.The renaming of
GetInvalidZRC20WithdrawToExternal
toInvalidZRC20WithdrawToExternalReceipt
enhances code clarity and maintains consistency with other function names in the file. This change improves overall code readability and maintainability.
325-327
: Approve renaming ofGetValidZRC20WithdrawToBTC
and comment enhancement.The renaming of
GetValidZRC20WithdrawToBTC
toValidZRC20WithdrawToBTCReceipt
improves code clarity and maintains consistency with other function names. The additional comment providing the receiver address enhances the context and usability of the function.
334-335
: Approve renaming ofGetValidZetaSentDestinationExternal
.The renaming of
GetValidZetaSentDestinationExternal
toValidZetaSentDestinationExternalReceipt
enhances code clarity and maintains consistency with other function names in the file. This change contributes to improved overall code readability and maintainability.
Line range hint
1-335
: Summary of changes intestutil/sample/crosschain.go
.The modifications in this file consist of renaming four functions related to generating test data for cross-chain transactions. These changes enhance code clarity and maintain consistency in naming conventions. The refactoring aligns with the PR objectives of improving functionality and clarity in the ZetaChain ecosystem.
Key points:
- All changes are cosmetic and do not alter existing logic or introduce new functionality.
- The new function names are more descriptive and follow a consistent pattern.
- Comments have been updated to reflect the new function names, with some providing additional context.
These improvements contribute to better code readability and maintainability, which is crucial for test utilities in a complex system like ZetaChain.
x/crosschain/keeper/evm_hooks_test.go (10)
Line range hint
105-114
: LGTM: Sample data retrieval method updated correctly.The changes to use
InvalidZRC20WithdrawToExternalReceipt
are appropriate and maintain the existing test logic.
Line range hint
119-128
: LGTM: Sample data retrieval method updated correctly for BTC withdrawal.The changes to use
ValidZRC20WithdrawToBTCReceipt
are appropriate and maintain the existing test logic for BTC withdrawals.
Line range hint
134-143
: LGTM: Sample data retrieval method updated correctly for ETH withdrawal.The changes to use
ValidZrc20WithdrawToETHReceipt
are appropriate and maintain the existing test logic for ETH withdrawals.
Line range hint
149-153
: LGTM: Sample data retrieval method updated correctly for negative test case.The changes to use
ValidZRC20WithdrawToBTCReceipt
in the negative test case are appropriate and maintain the existing test logic.
161-162
: LGTM: Sample data retrieval methods updated consistently.The changes to use the new receipt retrieval methods (
ValidZRC20WithdrawToBTCReceipt
) are applied consistently across different test scenarios, maintaining the existing test logic.Also applies to: 171-172, 189-190, 199-200
251-252
: LGTM: Sample data retrieval methods updated consistently for various scenarios.The changes to use the new receipt retrieval methods (
ValidZRC20WithdrawToBTCReceipt
,ValidZrc20WithdrawToETHReceipt
) are applied consistently across different test scenarios, maintaining the existing test logic for ZRC20 withdrawals and ETH receipts.Also applies to: 277-278, 302-303, 321-322, 342-343, 365-366
390-391
: LGTM: Sample data retrieval methods updated consistently for various scenarios.The changes to use the new receipt retrieval methods (
ValidZrc20WithdrawToETHReceipt
,ValidZetaSentDestinationExternalReceipt
) are applied consistently across different test scenarios, maintaining the existing test logic for ZRC20 withdrawals, ETH receipts, and ZetaSent events.Also applies to: 418-419, 444-445, 459-460, 476-477, 487-488
525-526
: LGTM: Sample data retrieval methods updated consistently for ZetaSent scenarios.The changes to use the new receipt retrieval method (
ValidZetaSentDestinationExternalReceipt
) are applied consistently across different test scenarios, maintaining the existing test logic for ZetaSent events.Also applies to: 561-562, 591-592, 623-624, 654-655, 692-693
715-716
: LGTM: Sample data retrieval methods updated consistently for various scenarios.The changes to use the new receipt retrieval methods (
ValidZRC20WithdrawToBTCReceipt
,ValidZetaSentDestinationExternalReceipt
,InvalidZRC20WithdrawToExternalReceipt
) are applied consistently across different test scenarios, maintaining the existing test logic for ZRC20 withdrawals, ZetaSent events, and invalid withdrawal cases.Also applies to: 752-753, 782-783, 797-798, 820-821, 843-844, 868-869, 889-890
Line range hint
1-901
: Overall assessment: Sample data retrieval methods updated successfully.The changes in this file consistently update the sample data retrieval methods across various test scenarios. These updates maintain the existing test logic while presumably improving consistency or functionality in the test data generation. The modifications appear to be part of a larger refactoring effort and have been applied correctly throughout the file.
changelog.md (3)
Line range hint
1-56
: LGTM: Comprehensive changelog structureThe changelog is well-structured, providing a clear overview of changes across multiple versions. It includes sections for Features, Fixes, Refactor, Tests, and CI, which is a good practice for maintaining a detailed history of changes.
Line range hint
59-1589
: LGTM: Detailed changelog entriesThe changelog entries provide comprehensive information about changes, fixes, and improvements across multiple versions. This level of detail is beneficial for tracking the project's evolution and understanding the impact of each release.
Line range hint
1-1589
: Overall assessment: Well-maintained and informative changelogThe changelog is comprehensive, well-structured, and provides valuable information about each release. It follows good practices by categorizing changes into Features, Fixes, Refactor, Tests, and CI sections. This format makes it easy for users and developers to understand the evolution of the project and the impact of each release.
Minor suggestions:
- Consider standardizing event names for consistency (e.g.,
WithdrawedAndCalled
toWithdrawnAndCalled
).- Maintain the current level of detail in future entries to ensure continued clarity and usefulness of the changelog.
e2e/e2etests/test_v2_eth_withdraw_and_call_no_message.go (9)
1-14
: Package declaration and imports are appropriateThe package is correctly declared as
e2etests
, and all necessary imports are included for the functionality of the test.
15-17
: Function definition and argument validation are correctThe test function
TestV2ETHWithdrawAndCallNoMessage
is properly defined with parameters that suit its purpose. It correctly checks that exactly one argument (the amount to withdraw) is provided.
18-23
: Temporary gas limit adjustment is correctly handledThe gas limit is temporarily increased to
10,000,000
to accommodate the test requirements. The use ofdefer
ensures that the original gas limit is restored after the test execution, maintaining the integrity of subsequent tests.
24-26
: Amount parsing and validation are properly implementedThe amount is safely parsed from the input arguments using
big.NewInt(0).SetString(args[0], 10)
, and the validity is verified. The use ofrequire.True
ensures that the test fails with a clear message if the amount is invalid.
27-28
: ETH ZRC20 approval is correctly performedThe test appropriately calls
r.ApproveETHZRC20
with the gateway address to ensure that the necessary approvals are in place before performing the withdrawal.
30-35
: Withdrawal transaction is executed with correct parametersThe
V2ETHWithdrawAndCall
function is invoked with the correct parameters, including an empty byte slice for the message and appropriateRevertOptions
. This aligns with the test objective of handling withdrawals without a message.
37-41
: Cross-chain transaction status is accurately verifiedThe test waits for the cross-chain context (
cctx
) to be mined and asserts that the status isOutboundMined
. This ensures that the withdrawal process has been successfully completed on the cross-chain network.
43-46
: DApp call verification is successfully conductedThe test retrieves the
messageIndex
and usesAssertTestDAppEVMCalled
to verify that the DApp was called as expected with the correct amount. Error handling is properly managed withrequire.NoError
.
52-53
: Sender verification is correctly implementedThe test verifies that the sender used in the DApp matches the expected address (
r.ZEVMAuth.From
). Error handling is appropriately managed withrequire.NoError
, and the equality assertion ensures the integrity of the sender information.x/fungible/keeper/v2_deposits.go (2)
36-43
: Verify the completeness and correctness of conditional logicThe conditional branches based on
coinType
andisCrossChainCall
determine the execution path of the deposit processing. Ensure that all possible combinations ofcoinType
andisCrossChainCall
are appropriately handled and that the logic aligns with the intended functionality to prevent unexpected behaviors.
47-48
: Ensure fallback to simple deposit is appropriateThe default execution of
DepositZRC20
for cases not covered by the previous conditions assumes a simple deposit is required. Confirm that this fallback correctly represents all remaining scenarios and that no specific cases are unintentionally omitted from the conditional logic.x/crosschain/keeper/v2_zevm_inbound.go (1)
54-54
: 🛠️ Refactor suggestionAdjust logging level for normal processing
The log message at line 54 uses the
Error
level to indicate the processing of an inbound transaction, which is a standard operation. It's more appropriate to use theInfo
orDebug
level for such messages to avoid confusion and ensure that actual errors are not obscured by routine logs.Apply this change to adjust the log level:
- k.Logger(ctx).Error(fmt.Sprintf("processing inbound. zrc20: %s", zrc20.Hex())) + k.Logger(ctx).Info(fmt.Sprintf("Processing inbound transaction. zrc20: %s", zrc20.Hex()))Likely invalid or redundant comment.
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 54-54: x/crosschain/keeper/v2_zevm_inbound.go#L54
Added line #L54 was not covered by testspkg/contracts/testdappv2/TestDAppV2.sol (1)
2-2
: Ensure Compatibility with Updated Solidity VersionThe pragma has been updated to
^0.8.26
. Please verify that all dependencies and deployment tools are compatible with Solidity version 0.8.26 to prevent any potential compatibility issues.zetaclient/chains/evm/observer/v2_inbound.go (1)
202-202
: Confirm proper inclusion ofisCrossChainCall
flag.Including the
isCrossChainCall
flag ensures that theMsgVoteInbound
message accurately represents whether the event involves a cross-chain call, aligning with the updated protocol specifications.pkg/contracts/testdappv2/TestDAppV2.go (3)
54-55
: Ensure ABI and binary data are correctly updatedThe
ABI
andBin
fields inTestDAppV2MetaData
have been modified. Please verify that they accurately represent the updated contract and are consistent with the corresponding Solidity code to prevent any discrepancies during deployment or interaction.
242-255
: Ensure consistency in session methods forNOMESSAGECALL
The session methods for
NOMESSAGECALL
have been added. Verify that they align correctly with the caller methods and function as intended in different session contexts.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 245-246: pkg/contracts/testdappv2/TestDAppV2.go#L245-L246
Added lines #L245 - L246 were not covered by tests
[warning] 252-253: pkg/contracts/testdappv2/TestDAppV2.go#L252-L253
Added lines #L252 - L253 were not covered by tests
397-410
: Validate session methods forGetNoMessageIndex
The session methods related to
GetNoMessageIndex
have been added. Ensure that these methods are consistent with the caller implementations and correctly handle different call options.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 400-401: pkg/contracts/testdappv2/TestDAppV2.go#L400-L401
Added lines #L400 - L401 were not covered by tests
[warning] 407-408: pkg/contracts/testdappv2/TestDAppV2.go#L407-L408
Added lines #L407 - L408 were not covered by tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix and zetaclient update looks good to me. One minor question.
Description
Currently both would be interpreted as normal dpeosit or withdraw
This PR fix this with using a new field in the inbound and a new type of event in the gateway contracts
Smart contract associated PR: zeta-chain/protocol-contracts#403
Additional fix: set sender in context and remove origin for v2 deposits. In v2
msg.sender
is used instead oftx.origin
: 1ebd9a5Summary by CodeRabbit
New Features
Bug Fixes
Tests
Documentation